All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.qd.QDRect

java.lang.Object
   |
   +----quicktime.util.QTByteObject
           |
           +----quicktime.qd.QDRect

public final class QDRect
extends QTByteObject
implements PrimitivesLib, Cloneable
This class corresponds to the Rect and FixedRect Data structures. It has a current limitation of x and y < 32767 and x+width, y+height < 32767.

The width and height values are the number of pixels that will be seen - thus if x == 1 and width is 3, the pixels drawn will be pixels at 1, 2, 3.


Variable Index

 o kIsFixedRect
These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.
 o kIsRect
These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.

Constructor Index

 o QDRect()
Constructs a new rectangle, with (0, 0) origin and 0 width and height
 o QDRect(Dimension)
Constructs a rectangle at (0, 0) and initializes it to the specified width and height.
 o QDRect(float, float)
Constructs a rectangle and initializes it with the specified width and height parameters.
 o QDRect(float, float, float, float)
Constructs and initializes a rectangle with the specified parameters.
 o QDRect(int, int)
Constructs a rectangle and initializes it with the specified width and height parameters.
 o QDRect(int, int, int, int)
Constructs and initializes a rectangle with the specified parameters.
 o QDRect(Point)
Constructs a rectangle of 0 width and height and specified origin.
 o QDRect(Point, Dimension)
Constructs a rectangle and initializes it to a specified point and dimension.
 o QDRect(Rectangle)
Constructs a QDRect from a java.awt.Rectangle.

Method Index

 o add(float, float)
Adds a point to the QDRect.
 o add(int, int)
Adds a point to the QDRect.
 o add(Point)
Adds a point to the QDRect.
 o clone()
Return a copy of the QDRect
 o copy()
Returns a copy of the QDRect with the correct return type.
 o equals(Object)
Checks whether two QDRects are equal.
 o fromArray(byte[], int)
Creates a QDRect from an array of bytes.
 o getEndianDescriptorFixedRect()
Returns the EndianDescriptor for FixedRect Rect.
 o getEndianDescriptorRect()
Returns the EndianDescriptor for QDRect Rect.
 o getFixedRect()
Returns the bytes for the FixedRect
 o getHeight()
Get the height of the QDRect.
 o getHeightF()
Get the height of the QDRect.
 o getRect()
Returns the bytes for the QDRect
 o getWidth()
Get the width of the QDRect.
 o getWidthF()
Get the width of the QDRect.
 o getX()
Get the x location of the rect.
 o getXF()
Get the x location of the rect.
 o getY()
Get the y location of the rect.
 o getYF()
Get the y location of the rect.
 o grow(float, float)
Grows the QDRect horizontally and vertically.
 o grow(int, int)
Grows the QDRect horizontally and vertically.
 o hashCode()
Returns the hashcode for this Rectangle.
 o inside(float, float)
Checks if the specified point lies inside a QDRect.
 o inside(int, int)
Checks if the specified point lies inside a QDRect.
 o intersection(QDRect)
Computes the intersection of two QDRects, returning the largets rect that encompasses both rects.
 o intersects(QDRect)
Checks if two QDRects intersect.
 o isDifferentOrigin(QDRect)
Returns true if the QDRect argument has a different origin.
 o isDifferentSize(QDRect)
Returns true if the QDRect argument is a different size.
 o isEmpty()
Determines whether the QDRect is empty.
 o move(float, float)
Moves the QDRect to x, y.
 o move(int, int)
Moves the QDRect to x, y.
 o reshape(float, float, float, float)
Reshapes the QDRect to x, y, width and height.
 o reshape(int, int, int, int)
Reshapes the QDRect to x, y, width and height.
 o resize(float, float)
Resizes the QDRect.
 o resize(int, int)
Resizes the QDRect.
 o setHeight(float)
Set the height of the QDRect.
 o setHeight(int)
Set the height of the QDRect.
 o setWidth(float)
Set the width of the QDRect.
 o setWidth(int)
Set the width of the QDRect.
 o setX(float)
Set the x location of the rect.
 o setX(int)
Set the x location of the rect.
 o setY(float)
Set the y location of the rect.
 o setY(int)
Set the y location of the rect.
 o toRectangle()
Returns a java.awt.Rectangle corresponding to the current state.
 o toString()
Returns the String representation of this QDRect's values.
 o translate(float, float)
Translates the QDRect deltaX and deltaY.
 o translate(int, int)
Translates the QDRect deltaX and deltaY.
 o union(QDRect)
Computes the union of two QDRects, returning the smallest Rect that is the union of the two QDRects.

Variables

 o kIsRect
 public static final int kIsRect
These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.

 o kIsFixedRect
 public static final int kIsFixedRect
These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.

Constructors

 o QDRect
 public QDRect()
Constructs a new rectangle, with (0, 0) origin and 0 width and height

 o QDRect
 public QDRect(int x,
               int y,
               int width,
               int height)
Constructs and initializes a rectangle with the specified parameters. Int values will be cast to shorts.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width of the rectangle
height - the height of the rectangle
 o QDRect
 public QDRect(float x,
               float y,
               float width,
               float height)
Constructs and initializes a rectangle with the specified parameters.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width of the rectangle
height - the height of the rectangle
 o QDRect
 public QDRect(int width,
               int height)
Constructs a rectangle and initializes it with the specified width and height parameters.

Parameters:
width - the width of the rectangle
height - the height of the rectangle
 o QDRect
 public QDRect(float width,
               float height)
Constructs a rectangle and initializes it with the specified width and height parameters.

Parameters:
width - the width of the rectangle
height - the height of the rectangle
 o QDRect
 public QDRect(Point origin,
               Dimension size)
Constructs a rectangle and initializes it to a specified point and dimension.

Parameters:
origin - the origin
size - the size of the rectangle
 o QDRect
 public QDRect(Point origin)
Constructs a rectangle of 0 width and height and specified origin.

Parameters:
origin - the origin
 o QDRect
 public QDRect(Dimension size)
Constructs a rectangle at (0, 0) and initializes it to the specified width and height.

Parameters:
size - the value of the width and height
 o QDRect
 public QDRect(Rectangle rect)
Constructs a QDRect from a java.awt.Rectangle.

Parameters:
rect - the java.awt.Rectangle

Methods

 o getEndianDescriptorFixedRect
 public static final EndianDescriptor getEndianDescriptorFixedRect()
Returns the EndianDescriptor for FixedRect Rect.

Returns:
an EndianDescriptor
 o getEndianDescriptorRect
 public static final EndianDescriptor getEndianDescriptorRect()
Returns the EndianDescriptor for QDRect Rect.

Returns:
an EndianDescriptor
 o fromArray
 public static QDRect fromArray(byte rectBytes[],
                                int flag)
Creates a QDRect from an array of bytes. The minimum length of the array must equate to the requirements of the size of the native structure to store the result.

Parameters:
rectBytes - the byte array containing the rect values
flag - flag that describes the format of the byte array
Returns:
a QDRect
Throws: IllegalArgumentException
if mismatch between minimum length of byte array and format flag
 o getRect
 public byte[] getRect()
Returns the bytes for the QDRect

 o getFixedRect
 public byte[] getFixedRect()
Returns the bytes for the FixedRect

 o getX
 public int getX()
Get the x location of the rect.

Returns:
the current x location
 o getXF
 public float getXF()
Get the x location of the rect.

Returns:
the current x location
 o setX
 public void setX(int x)
Set the x location of the rect.

Parameters:
x - the new x location
 o setX
 public void setX(float x)
Set the x location of the rect.

Parameters:
x - the new x location
 o getY
 public int getY()
Get the y location of the rect.

Returns:
the current y location
 o getYF
 public float getYF()
Get the y location of the rect.

Returns:
the current y location
 o setY
 public void setY(int y)
Set the y location of the rect.

Parameters:
y - the new y location
 o setY
 public void setY(float y)
Set the y location of the rect.

Parameters:
y - the new y location
 o isDifferentSize
 public boolean isDifferentSize(QDRect rect)
Returns true if the QDRect argument is a different size.

 o isDifferentOrigin
 public boolean isDifferentOrigin(QDRect rect)
Returns true if the QDRect argument has a different origin.

 o getWidth
 public int getWidth()
Get the width of the QDRect.

Returns:
the current width
 o getWidthF
 public float getWidthF()
Get the width of the QDRect.

Returns:
the current width
 o setWidth
 public void setWidth(int width)
Set the width of the QDRect.

Parameters:
width - the new width
 o setWidth
 public void setWidth(float width)
Set the width of the QDRect.

Parameters:
width - the new width
 o getHeight
 public int getHeight()
Get the height of the QDRect.

Returns:
the current height
 o getHeightF
 public float getHeightF()
Get the height of the QDRect.

Returns:
the current height
 o setHeight
 public void setHeight(int height)
Set the height of the QDRect.

Parameters:
height - the new height
 o setHeight
 public void setHeight(float height)
Set the height of the QDRect.

Parameters:
height - the new height
 o reshape
 public void reshape(int x,
                     int y,
                     int width,
                     int height)
Reshapes the QDRect to x, y, width and height.

 o reshape
 public void reshape(float x,
                     float y,
                     float width,
                     float height)
Reshapes the QDRect to x, y, width and height.

 o move
 public void move(int x,
                  int y)
Moves the QDRect to x, y.

 o move
 public void move(float x,
                  float y)
Moves the QDRect to x, y.

 o translate
 public void translate(int deltaX,
                       int deltaY)
Translates the QDRect deltaX and deltaY.

 o translate
 public void translate(float deltaX,
                       float deltaY)
Translates the QDRect deltaX and deltaY.

 o resize
 public void resize(int width,
                    int height)
Resizes the QDRect.

 o resize
 public void resize(float width,
                    float height)
Resizes the QDRect.

 o inside
 public boolean inside(int x,
                       int y)
Checks if the specified point lies inside a QDRect.

Parameters:
x - the x coordinate
y - the y coordinate
 o inside
 public boolean inside(float x,
                       float y)
Checks if the specified point lies inside a QDRect.

Parameters:
x - the x coordinate
y - the y coordinate
 o intersects
 public boolean intersects(QDRect r)
Checks if two QDRects intersect.

 o intersection
 public QDRect intersection(QDRect r)
Computes the intersection of two QDRects, returning the largets rect that encompasses both rects.

Parameters:
r - the rect to intersect with
Returns:
a QDRect
 o union
 public QDRect union(QDRect r)
Computes the union of two QDRects, returning the smallest Rect that is the union of the two QDRects.

Parameters:
r - the rect to unify with this
Returns:
a rect
 o add
 public void add(int newX,
                 int newY)
Adds a point to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.

 o add
 public void add(float newX,
                 float newY)
Adds a point to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.

 o add
 public void add(Point pt)
Adds a point to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.

 o grow
 public void grow(int h,
                  int v)
Grows the QDRect horizontally and vertically. This method modifies the QDRect so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

 o grow
 public void grow(float h,
                  float v)
Grows the QDRect horizontally and vertically. This method modifies the QDRect so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

 o isEmpty
 public boolean isEmpty()
Determines whether the QDRect is empty.

 o hashCode
 public int hashCode()
Returns the hashcode for this Rectangle.

Overrides:
hashCode in class Object
 o equals
 public boolean equals(Object obj)
Checks whether two QDRects are equal.

Overrides:
equals in class QTByteObject
 o toString
 public String toString()
Returns the String representation of this QDRect's values.

Overrides:
toString in class QTByteObject
 o clone
 public Object clone()
Return a copy of the QDRect

Returns:
a QDRect
Overrides:
clone in class Object
 o copy
 public QDRect copy()
Returns a copy of the QDRect with the correct return type.

Returns:
a QDRect
 o toRectangle
 public Rectangle toRectangle()
Returns a java.awt.Rectangle corresponding to the current state.

Returns:
the java.awt.Rectangle

All Packages  Class Hierarchy  This Package  Previous  Next  Index